#include<iostream>
#include<vector>
#include<string>
using namespace std;
bool match(int name,int a,int b,int c){
  return name==a&&a==b&&b==c;
}
bool isFinish(vector<vector<int>> &board,int name){
  for(int i=0;i<3;i++){
    if(match(name,board[i][0],board[i][1],board[i][2])) return true;
    if(match(name,board[0][i],board[1][i],board[2][i])) return true;
  }
  if(match(name,board[0][0],board[1][1],board[2][2])) return true;
  if(match(name,board[2][0],board[1][1],board[0][2])) return true;
  return false;
}
int main(){
  auto board=vector(3,vector<int>(3,-1));
  string str;
    cin>>str;
    for(int i=0;i<str.size();i++){
    int put=str[i]-'1';
    board[put/3][put%3]=i%2;//小a是0
    }
  if(isFinish(board,0)) cout<<"xiaoa wins."<<endl;
  else if(isFinish(board,1)) cout<<"uim wins."<<endl;
  else cout<<"drew."<<endl;
}